
//校验数据库
function validateMysqlDriverConfig($this, driverConfig){
	var driver = $this.find("input[name='driver']").val();
	var username = $this.find("input[name='username']").val();
	var password = $this.find("input[name='password']").val();
	var table = $this.find("input[name='table']").val();
	var primaryKey = $this.find("input[name='primaryKey']").val().toLocaleUpperCase();
	var url = $this.find("textarea[name='url']").val();

	driverConfig.driverClassName=driver;
	driverConfig.username=username;
	driverConfig.password=password;
	driverConfig.table=table;
	driverConfig.name=table;
	driverConfig.primaryKey=primaryKey;
	driverConfig.url=url;
	
	//校验database表单
	if($this.formValidate()==false){
		return null;
	}
	
	//读取连接信息
	var result;
	var isSuccess;
	$.ajax({  
		url : $basePath + "/driver/getMysqlConnector",  
		contentType:"application/x-www-form-urlencoded",
	    type : "post",  
	    data : driverConfig,  
	    async : false,
	    success : function(data){
	    	isSuccess = data.success;
	    	if(isSuccess){
	    		result = data.resultValue;
	    	}else{
	    		bootGrowl(data.resultValue,"danger"); 
	    	}
	    }
    });

	//如果验证成功
	if(isSuccess && result!=null){
		var metaInfo = result.metaInfo;
		var cols = [];
		for (var i = 0; i < metaInfo.length; i++) {
			var col = metaInfo[i];
			cols.push({
				"name": col['name'],
				"typeName": col['typeName'],
				"type": col['type']
			});
		}
		driverConfig.column = cols;
	}
	return result;
}

